using System;
using System.ComponentModel;
using System.Data;
using System.Runtime.Serialization;

namespace DataAccess
{
	/// <summary>
	/// A custom serializable dataset containing Adm_areas information.
	/// </summary>
	[Serializable()]
	[DesignerCategory("code")]
	public class AreasData : DataTable
	{
		///
		/// Constants for table and fields mapping
		///
		public const String ADM_AREAS_TABLE = "ADM_AREAS";
		public const String ARE_ID_FIELD = "ARE_ID";
		public const String ARE_NOMBRE_FIELD = "ARE_NOMBRE";
		public const String ARE_ADMINISTRABLE_FIELD = "ARE_ADMINISTRABLE";
		public const String ARE_ACTIVAR_NOMBRE_FIELD = "ARE_ACTIVAR_NOMBRE";
		public const String ARE_ASOCIAR_USUARIOS_FIELD = "ARE_ASOCIAR_USUARIOS";

		protected AreasData(SerializationInfo info, StreamingContext context)
		{
		}

		public AreasData()
		{
			BuildDataTables();
		}


		/// <summary>
		/// Creates the following datatables: Adm_areas
		/// </summary>
		private void BuildDataTables()

		{
			this.TableName =  ADM_AREAS_TABLE;
			
			Columns.Add(ARE_ID_FIELD, typeof (Decimal));
			Columns.Add(ARE_NOMBRE_FIELD, typeof (String));
			Columns.Add(ARE_ADMINISTRABLE_FIELD, typeof (String));
			Columns.Add(ARE_ACTIVAR_NOMBRE_FIELD, typeof (String));
			Columns.Add(ARE_ASOCIAR_USUARIOS_FIELD, typeof (String));

			PrimaryKey = new DataColumn[] {this.Columns[ARE_ID_FIELD]};
		}

		/// <summary>
		/// Add a new row to the table
		/// </summary>
		/// <param name="row">Dataset row</param>
		public void addAreas(DataRow row)
		{
			this.Rows.Add(row);
		}
	}
}